VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "cResumen"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
'---------------------------------------------------------------------------------------
' Module    : cResumen
' DateTime  : 30/11/2011 12:08
' Author    :
' Purpose   : Clase Control Resumen
'---------------------------------------------------------------------------------------
Option Explicit
Dim lResumen As New lResumen
Dim lParametro As New lParametro
Dim cmesa As New cmesa
Public Sub getBean(Optional bResumen As bResumen)
Dim result As Integer
result = lResumen.getBean(bResumen)
If result = UtilConstantes.OPT_ERROR_ENCONTRADO Then
    utilMensaje.muestraMensaje errorEncontrado
End If
End Sub
Public Sub cerrarTurno()
Dim i As Integer
Dim bResumen As New bResumen
For i = 1 To bparametro.lCompania.Count
    Set bResumen.bCompania = bparametro.lCompania.Item(i)
    bResumen.nDiaTrabajo = bparametro.nDiaTrabajo
    Set bResumen.busuario = bparametro.bUsuarioActivo
    'If utilMensaje.muestraMensaje(imprimirCierreParaEmpresa, bResumen.bCompania.sRazonSocial) = vbYes Then
    imprimirReporteX bResumen
    'End If
Next
End Sub
Public Sub cerrarDiaTrabajo()
Dim i As Integer
Dim breporteZ As breporteZ
'If Not cmesa.fn_validaCortez Then Exit Sub
If utilMensaje.muestraMensaje(confirmacionCierreDia) = vbNo Then
    Exit Sub
End If
For i = 1 To bparametro.lCompania.Count
    Set breporteZ = New breporteZ
    Set breporteZ.bCompania = bparametro.lCompania.Item(i)
    breporteZ.nDiaTrabajo = bparametro.nDiaTrabajo
    'If utilMensaje.muestraMensaje(imprimirCierreParaEmpresa, bResumen.bCompania.sRazonSocial) = vbYes Then
    imprimirReporteZ breporteZ
    'End If
Next
lParametro.cierraDiaTrabajo
End Sub
Public Sub imprimirReporteX(bResumen As bResumen)
Dim result  As Integer
Dim ancho As Integer
    ancho = 3800
 
    result = lResumen.getResumenRptX(bResumen)
    If result = UtilConstantes.OPT_ERROR_ENCONTRADO Then
        utilMensaje.muestraMensaje ImposibleImprimirReporteZ
        Exit Sub
    End If

    util.setPrinter bResumen.bCompania.bPuntoVenta.snomImpresora

    Printer.CurrentY = 1
    Printer.Font.Name = "16 cpi"
    Printer.Font.Size = 8
    Printer.Print "        "
    Printer.CurrentX = ancho / 2 - Printer.TextWidth(bResumen.bCompania.sRazonSocial) / 2
    Printer.Print bResumen.bCompania.sRazonSocial
    If Trim(bResumen.bCompania.sSlogan) <> "" Then
        Printer.CurrentX = ancho / 2 - Printer.TextWidth(bResumen.bCompania.sSlogan) / 2
        Printer.Print bResumen.bCompania.sSlogan
    End If
    Printer.CurrentX = ancho / 2 - Printer.TextWidth("Telef: " & bResumen.bCompania.bPuntoVenta.sTelefono & "    R.U.C. " & bResumen.bCompania.sRuc) / 2
    Printer.Print "Telef: " & bResumen.bCompania.bPuntoVenta.sTelefono & "    R.U.C. " & bResumen.bCompania.sRuc
    Printer.Print "   "
     Printer.CurrentX = ancho / 2 - Printer.TextWidth("CIERRE DE TURNO") / 2
    Printer.Print "CIERRE DE TURNO"
    Printer.Print " "
    Printer.Print "    Dia Trabajado        :" & Space(1) & CStr(bResumen.nDiaTrabajo)
    Printer.Print "    Fecha de Inicio      :" & Space(1) & Format(bResumen.dFecha, "dd/mm/yyyy")
    Printer.Print "    Fecha de Cierre      :" & Space(1) & Format(bResumen.dFecha, "dd/mm/yyyy")
    Printer.Print "    Fecha de Impresion   :" + Space(1) & Format(Date, "dd/mm/yyyy")
    Printer.Print "    Hora de Impresion    :" + Space(1) & Format(Time(), "HH:MM")
    Printer.Print "    Impreso por          : " + UCase(bparametro.bUsuarioActivo.sNombre)
    Printer.Print " "
    'BASE IMPONIBLE
    Printer.Print "    BASE IMPONIBLE";
    Printer.CurrentX = 2600 - Printer.TextWidth(":   S/.")
    Printer.Print ":   S/.";
    Printer.CurrentX = 3200 - Printer.TextWidth(Format(bResumen.nBaseRptX, "###,##0.00"))
    Printer.Print Format(bResumen.nBaseRptX, "##,##0.00")
    'IGV
    Printer.Print "    IGV";
    Printer.CurrentX = 2600 - Printer.TextWidth(":   S/.")
    Printer.Print ":   S/.";
    Printer.CurrentX = 3200 - Printer.TextWidth(Format(bResumen.nIgvRptX, "###,##0.00"))
    Printer.Print Format(bResumen.nIgvRptX, "##,##0.00")
    'SERVICIO
    Printer.Print "    SERVICIO";
    Printer.CurrentX = 2600 - Printer.TextWidth(":   S/.")
    Printer.Print ":   S/.";
    Printer.CurrentX = 3200 - Printer.TextWidth(Format(bResumen.nServicioRptX, "###,##0.00"))
    Printer.Print Format(bResumen.nServicioRptX, "##,##0.00")
    'TOTAL
    Printer.Print "----------------------------------------------------"
    Printer.Print "    VENTA TOTAL";
    Printer.CurrentX = 2600 - Printer.TextWidth(":   S/.")
    Printer.Print ":   S/.";
    Printer.CurrentX = 3200 - Printer.TextWidth(Format(bResumen.nTotalRptX, "###,##0.00"))
    Printer.Print Format(bResumen.nTotalRptX, "###,##0.00")
    Printer.Print " "
    Printer.Print "----------------------------------------------------"
    
    
    
'    Printer.Print Space(10) + "REPORTE DE BOLETAS"
'    Printer.Print " "
'    Printer.Print "No.Transacciones   : " & bResumen.nDocumentos
'    Printer.Print "Venta Neta  S/.    : " & Format(bResumen.nTotal, "###,###.00")
'    Printer.Print "I.G.V.      S/.    : " & Format(IGVBol, "###,###.00")
'    Printer.Print "Servicio    S/.    : " & Format(ServicioBol, "###,###.00")
'    Printer.Print "Venta Total S/.    : " & Format(TotalBol, "###,###.00")
'    Printer.Print "No.Ticket Inicial  : " & Format(PrimeraBol, "0000000")
'    Printer.Print "No.Ticket Final    : " & Format(UltimaBol, "0000000")
'    Printer.Print "No. Anulaciones    : " & CStr(NroBoletasAnuladas)
'    Printer.Print "Total Anulados S/. : " & CStr(TotalBoletasAnuladas)
'    Printer.Print " "
'    Printer.Print "----------------------------------------"
'    Printer.Print Space(10) + "REPORTE DE FACTURAS"
'    Printer.Print " "
'    Printer.Print "No.Transacciones   : " & NroFacturas
'    Printer.Print "Venta Neta  S/.    : " & Format(BaseImpFact, "###,###.00")
'    Printer.Print "I.G.V.      S/.    : " & Format(IGVFAct, "###,###.00")
'    Printer.Print "Servicio    S/.    : " & Format(ServicioFact, "###,###.00")
'    Printer.Print "Venta Total S/.    : " & Format(TotalFact, "###,###.00")
'    Printer.Print "No.Factura Inicial : " & Format(PrimeraFact, "0000000")
'    Printer.Print "No.Factura Final   : " & Format(UltimaFact, "0000000")
'    Printer.Print "No. Anulaciones    : " & CStr(NroFacturasAnuladas)
'    Printer.Print "Total Anuladas S/. : " & CStr(TotalFacturasAnuladas)
'    Printer.Print " "
'    Printer.Print "----------------------------------------"
'    Printer.Print " "

    Printer.Print ""
    Printer.Print ""
    Printer.Print ""
    Printer.Print ""
    Printer.Print ""
    Printer.Print "."
    Printer.EndDoc
   
End Sub
Public Sub imprimirReporteZ(breporteZ As breporteZ)
Dim result  As Integer
Dim ancho As Integer
Dim guiaSalida As Integer
    ancho = 3800
 
    result = lResumen.getResumenRptZ(breporteZ)
    guiaSalida = lResumen.generarGuiaVentas(breporteZ.nDiaTrabajo)
   
    If result = UtilConstantes.OPT_ERROR_ENCONTRADO Then
        utilMensaje.muestraMensaje ImposibleImprimirReporteZ
        Exit Sub
    End If
    If guiaSalida <> 0 Then
        utilMensaje.muestraMensaje GuiaSalidaGenerada, Format("00000000", guiaSalida)
    End If

    util.setPrinter breporteZ.bCompania.bPuntoVenta.snomImpresora

    Printer.CurrentY = 1
    Printer.Font.Name = "16 cpi"
    Printer.Font.Size = 8
    Printer.Print "        "
    Printer.CurrentX = ancho / 2 - Printer.TextWidth(breporteZ.bCompania.sRazonSocial) / 2
    Printer.Print breporteZ.bCompania.sRazonSocial
    If Trim(breporteZ.bCompania.sSlogan) <> "" Then
        Printer.CurrentX = ancho / 2 - Printer.TextWidth(breporteZ.bCompania.sSlogan) / 2
        Printer.Print breporteZ.bCompania.sSlogan
    End If
    Printer.CurrentX = ancho / 2 - Printer.TextWidth("Telef: " & breporteZ.bCompania.bPuntoVenta.sTelefono & "    R.U.C. " & breporteZ.bCompania.sRuc) / 2
    Printer.Print "Telef: " & breporteZ.bCompania.bPuntoVenta.sTelefono & "    R.U.C. " & breporteZ.bCompania.sRuc
    Printer.Print "   "
    Printer.CurrentX = ancho / 2 - Printer.TextWidth("CIERRE DE TURNO") / 2
    Printer.Print "CIERRE DE TURNO"
    Printer.Print " "
    Printer.Print "    Dia Trabajado        :" & Space(1) & CStr(breporteZ.nDiaTrabajo)
    Printer.Print "    Fecha de Inicio      :" & Space(1) & Format(breporteZ.dMinFecRegistro, "dd/mm/yyyy")
    Printer.Print "    Fecha de Cierre      :" & Space(1) & Format(breporteZ.dMaxFecRegistro, "dd/mm/yyyy")
    Printer.Print "    Fecha de Impresion   :" + Space(1) & Format(Date, "dd/mm/yyyy")
    Printer.Print "    Hora de Impresion    :" + Space(1) & Format(Time(), "HH:MM")
    Printer.Print "    Impreso por          : " + UCase(bparametro.bUsuarioActivo.sNombre)
    Printer.Print " "
    'BASE IMPONIBLE
    Printer.Print "    BASE IMPONIBLE";
    Printer.CurrentX = 2600 - Printer.TextWidth(":   S/.")
    Printer.Print ":   S/.";
    Printer.CurrentX = 3200 - Printer.TextWidth(Format(breporteZ.nBasImpTickets + breporteZ.nBasImpFacturas, "###,##0.00"))
    Printer.Print Format(breporteZ.nBasImpTickets + breporteZ.nBasImpFacturas, "##,##0.00")
    'IGV
    Printer.Print "    IGV";
    Printer.CurrentX = 2600 - Printer.TextWidth(":   S/.")
    Printer.Print ":   S/.";
    Printer.CurrentX = 3200 - Printer.TextWidth(Format(breporteZ.nIgvTickets + breporteZ.nIgvFacturas, "###,##0.00"))
    Printer.Print Format(breporteZ.nIgvTickets + breporteZ.nIgvFacturas, "##,##0.00")
    'SERVICIO
    Printer.Print "    SERVICIO";
    Printer.CurrentX = 2600 - Printer.TextWidth(":   S/.")
    Printer.Print ":   S/.";
    Printer.CurrentX = 3200 - Printer.TextWidth(Format(breporteZ.nSerTickets + breporteZ.nSerFacturas, "###,##0.00"))
    Printer.Print Format(breporteZ.nSerTickets + breporteZ.nSerFacturas, "##,##0.00")
    'TOTAL
    Printer.Print "--------------------------------------------------------"
    Printer.Print "    VENTA TOTAL";
    Printer.CurrentX = 2600 - Printer.TextWidth(":   S/.")
    Printer.Print ":   S/.";
    Printer.CurrentX = 3200 - Printer.TextWidth(Format(breporteZ.ntotTickets + breporteZ.nTotFacturas, "###,##0.00"))
    Printer.Print Format(breporteZ.ntotTickets + breporteZ.nTotFacturas, "###,##0.00")
    Printer.Print " "
    Printer.Print "--------------------------------------------------------"
    
    
    
    Printer.Print Space(10) + "REPORTE DE BOLETAS"
    Printer.Print " "
    Printer.Print "    No.Transacciones   : " & breporteZ.nNumTickets
    Printer.Print "    Base Imp    S/.    : " & Format(breporteZ.nBasImpTickets, "###,##0.00")
    Printer.Print "    I.G.V.      S/.    : " & Format(breporteZ.nIgvTickets, "###,##0.00")
    Printer.Print "    Servicio    S/.    : " & Format(breporteZ.nSerTickets, "###,##0.00")
    Printer.Print "    Venta Total S/.    : " & Format(breporteZ.ntotTickets, "###,##0.00")
    Printer.Print "    No.Ticket Inicial  : " & Format(breporteZ.nMinTicket, "0000000")
    Printer.Print "    No.Ticket Final    : " & Format(breporteZ.nMaxTicket, "0000000")
    Printer.Print "    No. Anulaciones    : " & CStr(breporteZ.nAnuTickets)
    Printer.Print "    Total Anulados S/. : " & CStr(breporteZ.nTotAnuTickets)
    Printer.Print " "
    Printer.Print "--------------------------------------------"
    Printer.Print Space(10) + "REPORTE DE FACTURAS"
    Printer.Print " "
    Printer.Print "    No.Transacciones   : " & breporteZ.nNumFacturas
    Printer.Print "    Base Imp    S/.    : " & Format(breporteZ.nBasImpFacturas, "###,##0.00")
    Printer.Print "    I.G.V.      S/.    : " & Format(breporteZ.nIgvFacturas, "###,##0.00")
    Printer.Print "    Servicio    S/.    : " & Format(breporteZ.nSerFacturas, "###,##0.00")
    Printer.Print "    Venta Total S/.    : " & Format(breporteZ.nTotFacturas, "###,##0.00")
    Printer.Print "    No.Factura Inicial : " & Format(breporteZ.nMinFactura, "0000000")
    Printer.Print "    No.Factura Final   : " & Format(breporteZ.nMaxFactura, "0000000")
    Printer.Print "    No. Anulaciones    : " & CStr(breporteZ.nAnuFacturas)
    Printer.Print "    Total Anuladas S/. : " & CStr(breporteZ.nTotAnuFacturas)
    Printer.Print " "
    Printer.Print "----------------------------------------"
    Printer.Print " "

    Printer.Print ""
    Printer.Print ""
    Printer.Print ""
    Printer.Print ""
    Printer.Print ""
    Printer.Print " "
    Printer.Print ""
    Printer.Print ""
    Printer.Print ""
    Printer.Print "."
    Printer.EndDoc
End Sub



